package com.baselibrary.libs.design_mode.Observable_demo.Observable;


import com.baselibrary.libs.Utils.log.LogUtils;

import java.util.Observable;

/**
 * Created by 35876 于萌萌
 * 创建日期: 17:26 . 2017年02月05日
 * 描述:被观察者
 * <p>
 * <p>
 * 备注:
 */

public class GetData<T> extends Observable {
    private int id;
    private String name;
    private String data;
    private T mT;

    public T getT() {
        return mT;
    }

    public void setT(T t) {
        mT = t;
        setChanged();
        LogUtils.i("观察者设计模式 被观察者 装货 "+t);
        notifyObservers(mT);
        LogUtils.i("观察者设计模式 被观察者 装货 "+"几个响应到了"+this.countObservers());
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getData() {
        return data;
    }

    public void setData(String data) {
        this.data = data;
        setChanged();
        notifyObservers();
    }

    @Override
    public String toString() {
        return "GetData{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", data='" + data + '\'' +
                '}';
    }
}
